package com.anolesoft.amljmes.fortysix.service.mapper;

import com.anolesoft.amljmes.fortysix.dto.MesBzzPtdmxDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface MesBzzCpptmxServiceMapper {
    @Select("select rownum no,a.* from mes_bzz_ptdmx a where a.matching_doc_pk = #{matchingDocPk, jdbcType=VARCHAR}")
    List<MesBzzPtdmxDto> queryMesBzzCpptmx(@Param("matchingDocPk") String matchingDocPk);
    @Update("update mes_bzz_ptdmx set matched_quantity = matched_quantity + #{num, jdbcType = NUMERIC}," +
            " quantity_of_missing_parts = quantity_of_missing_parts - #{num, jdbcType = NUMERIC}" +
            " where objuid = #{objuid, jdbcType = VARCHAR}" )
    int updateCpptmxPt(@Param("objuid") String objuid,@Param("num") int num);
    @Update("update mes_bzz_ptdmx set matched_quantity = matched_quantity - #{num1, jdbcType = NUMERIC}," +
            " quantity_of_missing_parts = quantity_of_missing_parts + #{num1, jdbcType = NUMERIC}" +
            " where objuid = #{objuid, jdbcType = VARCHAR}")
    int updateCpptmxJc(@Param("objuid")String objuid,@Param("num1") int num1);
    @Select("select count(*) from mes_bzz_ptdmx a where a.matching_doc_pk = #{matchingDocPk, jdbcType=VARCHAR} and a.quantity_of_missing_parts != 0")
    int queryMesBzzCpptmxNum(@Param("matchingDocPk") String matchingDocPk);
}
